﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using MultiResolutioning.Files;
using MultiResolutioning.Structures;

namespace MultiResolutionService
{
	/// <summary>
	/// Summary description for Progressive
	/// </summary>
	[WebService(Namespace = "http://tempuri.org/")]
	[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
	[System.ComponentModel.ToolboxItem(false)]
	// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
	// [System.Web.Script.Services.ScriptService]
	public class Progressive : System.Web.Services.WebService
	{

		/// <summary>
		/// Wczytuje i przesyla siatke bazowa.
		/// </summary>
		/// <param name="name">nazwa siatki.</param>
		[WebMethod]
		public string LoadMeshBase(string name)
		{
			return ProgressiveMeshFile.LoadMeshToString(Context.Server.MapPath(name));
		}

		/// <summary>
		/// Wczytuje i przesyla liste operacji dzielenia.
		/// </summary>
		/// <param name="name">Nazwa siatki.</param>
		/// <param name="lastSplit">Ostanio wykonana operacja dzielenia.</param>
		/// <param name="count">Liczba opracji dzielenia.</param>
		/// <returns></returns>
		[WebMethod]
		public List<Split> LoadSplits(string name, int lastSplit, int count)
		{
			return ProgressiveMeshFile.LoadSplits(Context.Server.MapPath(name), lastSplit, count);
		}
	}
}
